package com.jimmy.ioc.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @version 1.0
 * @ ClassName MyBeanPostProcessor
 * 后置处理器：初始化前后进行处理工作
 * 将后置处理器加入到容器中
 * @ author JIMMY
 * @ Date 2020/12/7 0007 下午 12:31
 */
@Component
public class MyBeanPostProcessor implements BeanPostProcessor {
    //postProcessBeforeInitialization:在初始化之前工作
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("postProcessBeforeInitialization..."+beanName+"=>"+bean);
        return bean;
    }
    //postProcessBeforeInitialization:在初始化之后工作
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("postProcessAfterInitialization..."+beanName+"=>"+bean);
        return bean;
    }
}
